<template>
    <div style="max-width: 960px;margin: 0 auto;">
        <Header></Header>

        <el-container>

            <el-row style="text-align: right;font-size: medium">
                <el-col :span="24" style="text-align: left;font-weight: 700;margin-left: 40px" >
                    <div>企业基本信息更新信息确认</div>
                </el-col>
                <el-col :span="5">
                    <span>统一社会信用代码</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.orgId}}</span>
                </el-col>
                <el-col :span="5">
                    <span>机构名称</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.orgName}}</span>
                </el-col>

                <el-col :span="5">
                    <span>法定代表人</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.legalName}}</span>
                </el-col>

                <el-col :span="5">
                    <span>法定代表人证件号</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.legalIdcard}}</span>
                </el-col>

                <el-col :span="5">
                    <div class="grid-content bg-purple">注册地址
                    </div>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.orgAddr}}</span>
                </el-col>

                <el-col :span="5">
                    <div class="grid-content bg-purple">联系方式
                    </div>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.mobile}}</span>
                </el-col>

                <el-col :span="5">
                    <div class="grid-content bg-purple">联系人姓名
                    </div>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.contactName}}</span>
                </el-col>

                <el-col :span="5">
                    <span class="grid-content bg-purple">联系人身份证号</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>： {{this.$route.params.ruleForm.contIdcard}}</span>
                </el-col>


                <el-col :span="5">
                    <span class="grid-content bg-purple">营业执照照片</span>
                </el-col>
                <el-col :span="19" style="text-align: left;">
                    <vue-preview :slides="slide1" class="preview" alt=""></vue-preview>
                </el-col>


                <el-col :span="5">
                    <span class="grid-content bg-purple">法人证件</span>
                </el-col>
                <el-col :span="19" style="text-align: left;">
                    <vue-preview :slides="slide2" class="preview" alt=""></vue-preview>
                </el-col>

                <el-col :span="5">
                    <span class="grid-content bg-purple">联系人身份证</span>
                </el-col>
                <el-col :span="19" style="text-align: left;">
                    <vue-preview :slides="slide3" class="preview" alt=""></vue-preview>
                </el-col>
            </el-row>
        </el-container>

        <el-divider/>
        <div>
            <!-- `checked` 为 true 或 false -->
            <el-checkbox v-model="checked" label=" " style=""/>
            <div style="display: inline-block;font-size: small;color: chocolate">
                请认真核对填写的信息是否与营业执照、法人证件的信息完全一致，确认无误后再提交，
                如需修改请返回，但如果提交的信息错误，将不能通过审核无法注册
            </div>
        </div>
<div style="float:right;margin-top: 20px;margin-right: 20px;">
    <el-button
               type="primary" @click="onSubmit1()">返回修改
    </el-button>
    <el-button
               type="primary" @click="onSubmit2()">确认提交
    </el-button>
</div>

    </div>
</template>

<script>
    import Header from "../../../components/Header";
    import {refresh} from "../../../api/orgBaseMG";

    export default {
        name: "UpdateConfirm",
        components: {Header},
        data() {
            return {
                slide1:[],
                slide2: [],
                slide3:[],
                checked: false
            }
        },
        methods:{
            onSubmit1() {
                let info = this.$route.params.ruleForm;
                this.$router.push({name:"UpdateOrg",params:{"ruleForm":info}})
            },
            onSubmit2(){
                let info = this.$route.params.ruleForm;
                if (this.checked === false) {
                    this.$message.error("需勾选注意事项再提交！");
                    return false;
                }
                else{
                    refresh(info).then(res=>{
                        if (res.code === 200){
                            console.log("=======上传更新信息========");
                            console.log(info);
                            this.$router.push({name:"SuccessUpdate"})
                        }
                    })
                }
            },
        },
        created() {
            let temp = {
                src: "http://localhost:8082/" + this.$route.params.ruleForm.orgFilePath,
                msrc: "http://localhost:8082/" + this.$route.params.ruleForm.orgFilePath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide1 = [temp];
            let temp2 = {
                src: "http://localhost:8082/" + this.$route.params.ruleForm.legalIdPath,
                msrc: "http://localhost:8082/" + this.$route.params.ruleForm.legalIdPath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide2 = [temp2];
            console.log("info", this.orgInfo);
            let temp3 = {
                src: "http://localhost:8082/" + this.$route.params.ruleForm.contPath,
                msrc: "http://localhost:8082/" + this.$route.params.ruleForm.contPath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide3 = [temp3];
            console.log("info", this.orgInfo);
        }
    }

</script>

<style scoped>

    .el-container {
        margin-top: 20px;
        text-align: center;
        font-size: 14px;
        line-height: 50px;
    }

</style>